/******************************************************************************

                            Online Java Compiler.
                Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.

*******************************************************************************/

import java.util.*;

public class Main
{
  public static void main (String[]args)
  {

    Scanner myObj = new Scanner (System.in);	// Create a Scanner object
      System.out.println ("Enter first of number:");

    int x = myObj.nextInt ();	// Read numbers

    while (x != 1)		// check if not in loop
      {
	if (x % 2 == 0)		//if even
	  x = x / 2;
	else			//if even
	  x = 3 * x + 1;
	System.out.println (x);
      }

  }
}
